<template>
	<div>
		<r-search
			ref="search"
			labelWidth="180px"
			labelPosition="right"
			:searchData="searchData"
			:searchForm="searchForm"
			:searchHandle="searchHandle"
			:inline="false"
			:searchRules="searchRules"
		/>
	</div>
</template>

<script>
export default {
	name: 'platform_information',
	data() {
		return {
			searchData: {
				bt_48: '',
				remark_48:'',
				bt_60: '',
				remark_60:'',
				bt_72: '',
				remark_72:'',
				
				
			},
			searchForm: [
				{ type: 'input', label: '48V 电池押金金额(元)', placeholder: '请输入', prop: 'bt_48', width: 500 },
				{ type: 'textarea', label: '48V 押金描述', placeholder: '请输入', prop: 'remark_48', width: 500 },
				{ type: 'input', label: '60V 电池押金金额(元)', placeholder: '请输入', prop: 'bt_60', width: 500 },
				{ type: 'textarea', label: '60V 押金描述', placeholder: '请输入', prop: 'remark_60', width: 500 },
				{ type: 'input', label: '72V 电池押金金额(元)', placeholder: '请输入', prop: 'bt_72', width: 500 },
				{ type: 'textarea', label: '72V 押金描述', placeholder: '请输入', prop: 'remark_72', width: 500 },
				
			],
			searchHandle: [{ type: 'primary', label: '保存', handle: e => this.elFormSubmit() }],
			searchRules: {
				bt_48: [{ required: true, message: '请输入', trigger: 'blur' }],
				remark_48: [{ required: true, message: '请输入', trigger: 'blur' }],
				bt_60: [{ required: true, message: '请输入', trigger: 'blur' }],
				remark_60: [{ required: true, message: '请输入', trigger: 'blur' }],
				bt_72: [{ required: true, message: '请输入', trigger: 'blur' }],
				remark_72: [{ required: true, message: '请输入', trigger: 'blur' }],
				
			}
		}
	},
	mounted() {
		this.getData()
	},
	methods: {
		async getData() {
			var res = await this.apis.deposit_info()
			var data = res.data || {}
			this.searchData = data
		
		},

		elFormSubmit() {
			this.$refs.search.$refs.ruleForm.validate(valid => {
				if (valid) {
					this.submit()
				}
			})
		},
		async submit() {
			var res = await this.apis.deposit_save(this.searchData)
			this.$message({
				message: '操作成功',
				type: 'success'
			})
		}
	}
}
</script>

<style scoped lang="scss">
.c1 {
	> div {
		> div:nth-child(1) {
			line-height: 40px;
			font-weight: bold;
			font-size: 18px;
		}
	}
}
</style>
